Dynomotion

Group: DynoMotion Message: 3985 From: quelisto Date: 2/20/2012
Subject: Trouble getting closed-loop 3PH BLDC to run
Tom: after trying just about everything I can think of, I can't get my BLDC to run successfully in closed loop. Mind you, I am NOT using the Halls at this point for anything other than a secondary source of information. I have a 512 index differential encoder, and the position on it updates just fine.

I can open-loop all day long with the Write3PH function and move stuff around, but once I enable the axis and try to do moves, the shaft is rigid (obviously lots of current) but no net motion. I have tried slowly changing the ch->CommutationOffset, and that eventually allows the shaft to break free just for a second, but the effect doesn't last for long.

Most worryingly, the motor current is quite high, and as I recall ch->stepperamplitude will have no effect on the current, so I'm not sure what to do about that either.

I am guessing that my commutation offset is wrong, but I'm using the midpoint of values I find at the transition between Hall states, so it SHOULD be pretty close to correct. I tried the AutoPhasefind program but it doesn't work correctly because the index pulse is pretty variable (I suspect it is susceptible to interference). So...any thoughts on how to proceed? Thanks.
Group: DynoMotion Message: 4008 From: Tom Kerekes Date: 2/20/2012
Subject: Re: Trouble getting closed-loop 3PH BLDC to run
Hi Erik,
 
You aren't really describing what method you are trying to use.  Brushless motors are complicated you need to get the commutation correct and also the servo parameters correct or it just won't work.  Let's try using the "normal" 3PH Servo Output Mode in conjunction with your encoder.  The first thing you need to determine is how many encoder counts per motor cycle there are so you can set the InvDistPerCycle parameter.  Do you know how to do this?  I would change the Write3PH function program to slowly output like 10 complete cycles.  Then see how many encoder counts it moves, then divide by 10, then round off to a multiple of 256 or whatever.
 
Something else that must be performed is phase finding.  Because we will be using the encoder to do the commutation and because the encoder is an incremental device we must somehow align or sync the encoder position to the motor.  To do this we can do something like command a fixed Write3PH function with phases position 0 to energize some coils.  This will cause the rotor to snap to some position.  After it settles out then we can zero the encoder.  We will now have a known relationship between the motor rotor/coils/encoder.
 
We also need to figure out the commutation offset that will work the best.  When we did the phase finding we actually found the position where those coils can generate zero torque.  If we move 1/4 cycle away then that position should be where those coils have maximum torque.  So try setting the commutation offset to 1/4 of how much the encoder changes for a full motor cycle.  If this doesn't work try the opposite direction.  Or in a worst case try random values over the range of 1 cycle.  If you get anywhere close (5%) the motor should commutate and work.
 
Set a PID gains of something like P=0.05 I=0 D=0 Filters=Clear.   Set a Max Output to limit the maximum output current 50 would be something like 1.7A.  Then enable the axis on the Step Response Screen.  The motor should form a weak servo.  If commutation is correct turning the motor should create an increasing restoring torque.  At the max torque the torque should be relatively constant as the motor turns multiple revolutions. 
 
HTH
TK

Group: DynoMotion Message: 4010 From: quelisto Date: 2/20/2012
Subject: Re: Trouble getting closed-loop 3PH BLDC to run
Tom: thanks for getting back to me. As I stated earlier, the encoder has 512 counts per rev, and I have inputted the correct inv_Dist_Per_Cycle (1.0/512.0).

I did not know that I needed to use Write3PH to hold the armature in a known magnetic position but that makes perfect sense.

As for the commutation offset, I thought this was in units of electric cycles (thus 0.000 to 1.000 cycles). Is it supposed to be in terms of encoder ticks? In other words something more like 512*5/12 = 213.33? Thus far I've been using values of +/- 0.5.

Also, could you explain what you meant by finding where the torque was equal to zero? I was not aware that Autophasefinder.C was doing something like that, it appeared to be open-loop moving the rotor back and forth without looking at the acceleration (which is about the only thing you could use to estimate torque sans a brake dyno or other motor).

-Erik-

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Erik,
>  
> You aren't really describing what method you are trying to use.  Brushless motors are complicated you need to get the commutation correct and also the servo parameters correct or it just won't work.  Let's try using the "normal" 3PH Servo Output Mode in conjunction with your encoder.  The first thing you need to determine is how many encoder counts per motor cycle there are so you can set the InvDistPerCycle parameter.  Do you know how to do this?  I would change the Write3PH function program to slowly output like 10 complete cycles.  Then see how many encoder counts it moves, then divide by 10, then round off to a multiple of 256 or whatever.
>  
> Something else that must be performed is phase finding.  Because we will be using the encoder to do the commutation and because the encoder is an incremental device we must somehow align or sync the encoder position to the motor.  To do this we can do something like command a fixed Write3PH function with phases position 0 to energize some coils.  This will cause the rotor to snap to some position.  After it settles out then we can zero the encoder.  We will now have a known relationship between the motor rotor/coils/encoder.
>  
> We also need to figure out the commutation offset that will work the best.  When we did the phase finding we actually found the position where those coils can generate zero torque.  If we move 1/4 cycle away then that position should be where those coils have maximum torque.  So try setting the commutation offset to 1/4 of how much the encoder changes for a full motor cycle.  If this doesn't work try the opposite direction.  Or in a worst case try random values over the range of 1 cycle.  If you get anywhere close (5%) the motor should commutate and work.
>  
> Set a PID gains of something like P=0.05 I=0 D=0 Filters=Clear.   Set a Max Output to limit the maximum output current 50 would be something like 1.7A.  Then enable the axis on the Step Response Screen.  The motor should form a weak servo.  If commutation is correct turning the motor should create an increasing restoring torque.  At the max torque the torque should be relatively constant as the motor turns multiple revolutions. 
>  
> HTH
> TK
>
>
> ________________________________
> From: quelisto <quelisto@...>
> To: DynoMotion@yahoogroups.com
> Sent: Monday, February 20, 2012 9:39 AM
> Subject: [DynoMotion] Trouble getting closed-loop 3PH BLDC to run
>
>
>  
> Tom: after trying just about everything I can think of, I can't get my BLDC to run successfully in closed loop. Mind you, I am NOT using the Halls at this point for anything other than a secondary source of information. I have a 512 index differential encoder, and the position on it updates just fine.
>
> I can open-loop all day long with the Write3PH function and move stuff around, but once I enable the axis and try to do moves, the shaft is rigid (obviously lots of current) but no net motion. I have tried slowly changing the ch->CommutationOffset, and that eventually allows the shaft to break free just for a second, but the effect doesn't last for long.
>
> Most worryingly, the motor current is quite high, and as I recall ch->stepperamplitude will have no effect on the current, so I'm not sure what to do about that either.
>
> I am guessing that my commutation offset is wrong, but I'm using the midpoint of values I find at the transition between Hall states, so it SHOULD be pretty close to correct. I tried the AutoPhasefind program but it doesn't work correctly because the index pulse is pretty variable (I suspect it is susceptible to interference). So...any thoughts on how to proceed? Thanks.
>
Group: DynoMotion Message: 4013 From: Tom Kerekes Date: 2/20/2012
Subject: Re: Trouble getting closed-loop 3PH BLDC to run
Hi Erik,
 
The invDistPerCycle is per cycle not per rev that is why you need to write the program.  So the 1.0/512 would not be the correct value.
 
The commutation offset is in encoder counts.
 
I did not say to use the AutoPhaseFind.c program.  Just command one Write3H value.  When the motor "locks" into a position (like a stepper motor) then we know the motor is generating zero torque.  If the motor was generating torque it would be accelerating.  So the motor naturally finds the spot where it does not generate any torque (this assumes there is nothing else applying torque).   Because the torque curve is a sine wave if we know where there is no torque then max torque must be 1/4 wave away.  Shifting one way or the other will invert the motor torque.
 
Regards
TK

Group: DynoMotion Message: 4018 From: quelisto Date: 2/21/2012
Subject: Re: Trouble getting closed-loop 3PH BLDC to run
That makes perfect sense, Tom. I thought by zero torque you meant "go limp as a noodle". Obviously, once "cogged" to a "step" there is only a torque felt if you try to displace the rotor by an external torque. In other words, I've just been a turkey about this the whole time. Ha ha, nothing new there!

Yes, good to confirm the CommutationOffset units are encoder counts, not in electric cycels as I had presumed.

Thanks for the help!

-Erik-

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Erik,
>  
> The invDistPerCycle is per cycle not per rev that is why you need to write the program.  So the 1.0/512 would not be the correct value.
>  
> The commutation offset is in encoder counts.
>  
> I did not say to use the AutoPhaseFind.c program.  Just command one Write3H value.  When the motor "locks" into a position (like a stepper motor) then we know the motor is generating zero torque.  If the motor was generating torque it would be accelerating.  So the motor naturally finds the spot where it does not generate any torque (this assumes there is nothing else applying torque).   Because the torque curve is a sine wave if we know where there is no torque then max torque must be 1/4 wave away.  Shifting one way or the other will invert the motor torque.
>  
> Regards
> TK
>
>
> ________________________________
> From: quelisto <quelisto@...>
> To: DynoMotion@yahoogroups.com
> Sent: Monday, February 20, 2012 6:37 PM
> Subject: [DynoMotion] Re: Trouble getting closed-loop 3PH BLDC to run
>
>
>  
> Tom: thanks for getting back to me. As I stated earlier, the encoder has 512 counts per rev, and I have inputted the correct inv_Dist_Per_Cycle (1.0/512.0).
>
> I did not know that I needed to use Write3PH to hold the armature in a known magnetic position but that makes perfect sense.
>
> As for the commutation offset, I thought this was in units of electric cycles (thus 0.000 to 1.000 cycles). Is it supposed to be in terms of encoder ticks? In other words something more like 512*5/12 = 213.33? Thus far I've been using values of +/- 0.5.
>
> Also, could you explain what you meant by finding where the torque was equal to zero? I was not aware that Autophasefinder.C was doing something like that, it appeared to be open-loop moving the rotor back and forth without looking at the acceleration (which is about the only thing you could use to estimate torque sans a brake dyno or other motor).
>
> -Erik-
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Erik,
> >  
> > You aren't really describing what method you are trying to use.  Brushless motors are complicated you need to get the commutation correct and also the servo parameters correct or it just won't work.  Let's try using the "normal" 3PH Servo Output Mode in conjunction with your encoder.  The first thing you need to determine is how many encoder counts per motor cycle there are so you can set the InvDistPerCycle parameter.  Do you know how to do this?  I would change the Write3PH function program to slowly output like 10 complete cycles.  Then see how many encoder counts it moves, then divide by 10, then round off to a multiple of 256 or whatever.
> >  
> > Something else that must be performed is phase finding.  Because we will be using the encoder to do the commutation and because the encoder is an incremental device we must somehow align or sync the encoder position to the motor.  To do this we can do something like command a fixed Write3PH function with phases position 0 to energize some coils.  This will cause the rotor to snap to some position.  After it settles out then we can zero the encoder.  We will now have a known relationship between the motor rotor/coils/encoder.
> >  
> > We also need to figure out the commutation offset that will work the best.  When we did the phase finding we actually found the position where those coils can generate zero torque.  If we move 1/4 cycle away then that position should be where those coils have maximum torque.  So try setting the commutation offset to 1/4 of how much the encoder changes for a full motor cycle.  If this doesn't work try the opposite direction.  Or in a worst case try random values over the range of 1 cycle.  If you get anywhere close (5%) the motor should commutate and work.
> >  
> > Set a PID gains of something like P=0.05 I=0 D=0 Filters=Clear.   Set a Max Output to limit the maximum output current 50 would be something like 1.7A.  Then enable the axis on the Step Response Screen.  The motor should form a weak servo.  If commutation is correct turning the motor should create an increasing restoring torque.  At the max torque the torque should be relatively constant as the motor turns multiple revolutions. 
> >  
> > HTH
> > TK
> >
> >
> > ________________________________
> > From: quelisto <quelisto@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Monday, February 20, 2012 9:39 AM
> > Subject: [DynoMotion] Trouble getting closed-loop 3PH BLDC to run
> >
> >
> >  
> > Tom: after trying just about everything I can think of, I can't get my BLDC to run successfully in closed loop. Mind you, I am NOT using the Halls at this point for anything other than a secondary source of information. I have a 512 index differential encoder, and the position on it updates just fine.
> >
> > I can open-loop all day long with the Write3PH function and move stuff around, but once I enable the axis and try to do moves, the shaft is rigid (obviously lots of current) but no net motion. I have tried slowly changing the ch->CommutationOffset, and that eventually allows the shaft to break free just for a second, but the effect doesn't last for long.
> >
> > Most worryingly, the motor current is quite high, and as I recall ch->stepperamplitude will have no effect on the current, so I'm not sure what to do about that either.
> >
> > I am guessing that my commutation offset is wrong, but I'm using the midpoint of values I find at the transition between Hall states, so it SHOULD be pretty close to correct. I tried the AutoPhasefind program but it doesn't work correctly because the index pulse is pretty variable (I suspect it is susceptible to interference). So...any thoughts on how to proceed? Thanks.
> >
>